<template>
    <el-dialog
      :title="title"
      :close-on-click-modal="false"
      :visible.sync="visible"
      :before-close="cancel"
      class="JNPF-dialog JNPF-dialog_center"
      lock-scroll
      width="85%"
    >

    <el-row class="JNPF-common-search-box" :gutter="16">
      <el-form @submit.native.prevent ref="elForm" :model="dataForm" :rules="rules">
        <el-col :span="8">
          <el-form-item label="计划单号" prop="FBILLNO">
            <el-input v-model="dataForm.FBILLNO"  disabled />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="制定日期" prop="FBILLCREDATE">
            <el-date-picker v-model="dataForm.FBILLCREDATE" value-format="yyyy-MM-DD" type="date" placeholder="选择日期">
            </el-date-picker>
          </el-form-item>
        </el-col>

        <el-col :span="8">
            <el-form-item label="计划状态">
              <el-select v-model="dataForm.FBILLSTATE" placeholder="请选择" disabled>
                <el-option
                  v-for="item in options1"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>


        <el-col :span="8">
          <el-form-item label="制定人员" prop="FUSER">
            <el-input v-model="dataForm.FUSER"   />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="计划起日" prop="FBEGDATE">
            <el-date-picker v-model="dataForm.FBEGDATE" value-format="yyyy-MM-DD" type="date" placeholder="选择日期">
            </el-date-picker>

        </el-form-item>

        </el-col>

        <el-col :span="8">
          <el-form-item label="计划讫日" prop="FENDDATE">
            <el-date-picker v-model="dataForm.FENDDATE" value-format="yyyy-MM-DD" type="date" placeholder="选择日期">
            </el-date-picker>
          </el-form-item>
        </el-col>    

        <el-col :span="8">
            <el-form-item label="保养类型">
              <el-select v-model="dataForm.FCATITEM" placeholder="请选择" >
                <el-option
                  v-for="item in options2"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="保养级别">
              <el-select v-model="dataForm.FCATTYPE" placeholder="请选择" >
                <el-option
                  v-for="item in options3"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

         <el-col :span="8">
          <el-form-item label="预计用时" prop="FTIME">
            <el-input v-model="dataForm.FTIME"   />
          </el-form-item>
        </el-col>

         <el-col :span="8">
          <el-form-item label="计划说明" prop="FMEMO">
            <el-input v-model="dataForm.FMEMO"   />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="审核人员" prop="FCHECKUSE">
            <el-input v-model="dataForm.FCHECKUSE" disabled  />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="审核日期" prop="FCHECKDATE">
            <el-input v-model="dataForm.FCHECKDATE"  disabled />
          </el-form-item>
        </el-col>

      </el-form>
    </el-row>

      <template>
     <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
      <el-tab-pane label="设备列表" name="first">
        <el-table :data="list1" border stripe>
          <el-table-column label="操作" width="80">
            <template slot-scope="scope">
              <el-button slot="reference" icon="el-icon-delete" style="color: red" @click="shopdate(scope.$index)"
                type="text">删除</el-button>
            </template>
          </el-table-column>
          <el-table-column prop="FENTRYID" label="序号" width="75" ></el-table-column>
          <el-table-column prop="FCATNO" label="设备编号" width="105"></el-table-column>
          <el-table-column prop="FCATNAME" label="设备名称" ></el-table-column>
          <el-table-column prop="FMEMO" label="备注" ></el-table-column>
        </el-table>
        <div class="addbox">
             <el-link icon="el-icon-plus" type="primary" >添加一行</el-link>
        </div>
      </el-tab-pane>
      <el-tab-pane label="场所列表" name="second">
        <el-table :data="list2" border stripe>
          <el-table-column label="操作" width="80">
            <template slot-scope="scope">
              <el-button slot="reference" icon="el-icon-delete" style="color: red" @click="shopdate(scope.$index)"
                type="text">删除</el-button>
            </template>
          </el-table-column>
          <el-table-column prop="FENTRYID" label="序号" width="75" ></el-table-column>
          <el-table-column prop="FCATNO" label="场所编号" width="105"></el-table-column>
          <el-table-column prop="FCATNAME" label="场所名称" ></el-table-column>
          <el-table-column prop="FMEMO" label="备注" ></el-table-column>
        </el-table>
        <div class="addbox">
             <el-link icon="el-icon-plus" type="primary" >添加一行</el-link>
        </div>
      </el-tab-pane>

      <!-- <el-tab-pane label="定时任务补偿" name="fourth">定时任务补偿</el-tab-pane> -->
     </el-tabs>
    </template>

      <span slot="footer" class="dialog-footer">
        <el-button @click="cancel">取 消</el-button>
        <el-button  v-if="insertorupdate" type="primary" v-loading="loading">确 定</el-button>
        <el-button v-else type="primary"  v-loading="loading">修 改</el-button>
      </span>
    </el-dialog>
  </template>
  <script>
  import jnpf from "@/utils/jnpf"
  export default {
    props: {
      parelist: {
        type: Array,
        default: []
      },
    },
    data() {
      return {
          activeName: 'first',
          title:"新增",
          dataForm:{
            FBILLNO: "K241130001", 
            FBILLCREDATE:"2024-11-30",
            FUSER: "韩信",
            FCATITEM:"日保养",
            FCATTYPE:"一级保养",
            FMEMO: "有机化学实验操作课",
            FBEGDATE: "2024-12-01",
            FENDDATE: "2025-11-30",
            FSTOCK:"化学系仓库",
            FSUPPLIER:"奉1教楼101",
            FCHECKUSE: "",
            FCHECKDATE: "",
            FNOTE:"",
            FTIME:1,
            FBILLSTATE: "申请中"
          },
          rules: {
            FCATNO: [
                  { required: true, message: '请输入保养类型编号', trigger: 'blur' },
              ],
              FCATNAME: [
                  { required: true, message: '请输入保养类型名称', trigger: 'blur' },
              ],
          },
        fvisiblelist:[
          {id:"1",fullName:"是"},
          {id:"2",fullName:"否"},
        ],

        list1:[
          {FENTRYID:1,FCATNO:"100003",FCATNAME:"春兰空调",FTIME:0.5,FMEMO:""},
          {FENTRYID:2,FCATNO:"100004",FCATNAME:"生物安全柜",FTIME:0.5,FMEMO:""},
          {FENTRYID:2,FCATNO:"100005",FCATNAME:"锡京通风柜T-19",FTIME:0.5,FMEMO:""},
        ],

        list2:[
          {FENTRYID:1,FCATNO:"100003",FCATNAME:"奉1教楼101",FMEMO:""},
          {FENTRYID:2,FCATNO:"100004",FCATNAME:"奉1教楼102",FMEMO:""},
          {FENTRYID:2,FCATNO:"100005",FCATNAME:"奉1教楼103",FMEMO:""},
        ],

        //所属校区选择数据
        options1: [{
          value: '1',
          label: '未提交'
        }, {
          value: '2',
          label: '已领出'
        }, {
          value: '3',
          label: '已取消'
        }],

        //所属校区选择数据
        options2: [{
          value: '1',
          label: '日保养'
        }, {
          value: '2',
          label: '周保养'
        }, {
          value: '3',
          label: '月保养'
        }, {
          value: '4',
          label: '季保养'
        }, {
          value: '5',
          label: '年保养'
        }],

        //所属校区选择数据
        options3: [{
          value: '1',
          label: '一级保养'
        }, {
          value: '2',
          label: '二级保养'
        }, {
          value: '3',
          label: '三级保养'
        }],

        loading:false,
        visible:false,
        insertorupdate:true
      };
    },
    created() {
    },
    mounted() {},
    methods: {
      //
      init(id){
        this.dataForm.FCATNO= id || ''
          if(this.dataForm.FCATNO)
          {
              this.title="修改"
             this.insertorupdate=false;
          }
          else
          {
            this.insertorupdate=true;
              this.title="新增";
          }
          this.visible=true;
      },
      //
      cancel(){
          this.$refs.elForm.resetFields();
          this.visible=false;
      },
    },
  };
  </script>
  
  
  
  
  